package com.market.mapper;

import com.github.pagehelper.Page;
import com.market.Dto.EmployeeQueryDto;
import com.market.Dto.EmployeeSaveDto;
import com.market.entity.Employee;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface EmployeeMapper {
    // 根据用户名查询用户
    @Select("select * from employee where username=#{username}")
    public Employee getByName(String username);

    /**
     * 分页查询
     * @param employeeQueryDto
     * @return
     */
    Page<Employee> pageQuery(EmployeeQueryDto employeeQueryDto);

    /**
     * 根据id获取员工详情
     * @param id
     */
    @Select("select * from employee where id=#{id}")
    Employee getById(Long id);

    /**
     * 新增员工
     * @param employee
     */
    void save(Employee employee);

    /**
     * 删除员工
     * @param id
     */
    @Delete("delete from employee where id=#{id}")
    void deleteById(Long id);

    /**
     * 修改员工
     * @param employee
     */
    void update(Employee employee);
}
